package Demo1;

class Shape{
    int age = 10;
    public void draw(){
        System.out.println("画图形");
    }
}
class Rect extends Shape{
    int age = 20;
    @Override
    public void draw() {
        System.out.println("画矩形");
    }
}

class Cycle extends Shape{
    public void draw(){
        System.out.println("画圆形");
    }
}

class Flower extends Shape{
    public void draw(){
        System.out.println("画花朵");
    }
}


public class Test {

    public static  void drawMap(Shape shape){
        shape.draw();
    }

    public static void main(String[] args) {
        drawMap(new Flower());
        drawMap(new Cycle());
        Shape shape = new Rect();
        System.out.println(shape.age);
    }


    public static void main1(String[] args) {
        Shape shape = new Rect();
        shape.draw();
        Shape shape2 = new Cycle();
        shape2.draw();
        Shape shape3 = new Flower();
        shape3.draw();
    }
}
